package com.sqx.modules.errand.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.modules.app.entity.UserEntity;
import com.sqx.modules.app.entity.UserMoneyDetails;
import com.sqx.modules.errand.entity.ErrandEvaluate;
import com.sqx.modules.errand.entity.TbIndent;
import com.sqx.modules.errand.entity.TrainingCenter;
import com.sqx.modules.order.entity.Evaluate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;

@Mapper
public interface UserInfoDao extends BaseMapper<ErrandEvaluate> {

    UserEntity findUserInfoById(Long userId);

    int certification(@Param("userId") Long userId, @Param("phone") String phone, @Param("userName") String userName,
                      @Param("identityCardNumber") String identityCardNumber, @Param("identityCardFront") String identityCardFront,
                      @Param("identityCardVerso") String identityCardVerso, @Param("selfIdentityCard") String selfIdentityCard,
                      @Param("format") String format, @Param("checkNumber") String checkNumber, @Param("cashDeposit") BigDecimal cashDeposit);

    int updateUserInfoById(@Param("nickName") String nickName,@Param("avatar") String avatar, @Param("phone") String phone, @Param("cashQrCode") String cashQrCode,
                           @Param("userId") Long userId);

    int userFeedback(@Param("feedbackType") Integer feedbackType,@Param("userId") Long userId, @Param("userEmail")String userEmail,@Param("feedbackScore") Integer feedbackScore,@Param("feedbackMessage") String feedbackMessage,@Param("format") String format);

    BigDecimal findIncomeday(@Param("userId") Long userId, @Param("date") String date);

    BigDecimal findPrepayMoneyday(Long userId, String date);

    BigDecimal findIncomemonth(Long userId, String date);

    BigDecimal findPrepayMoneymonth(Long userId, String date);

    BigDecimal findIncomesum(Long userId);

    BigDecimal findPrepayMoneysum(Long userId);

    int findIndentCount(@Param("userId") Long userId, @Param("date") String date);

    double findBalance(@Param("userId")Long userId);

    double findCashDeposit(Long userId);

    IPage<UserMoneyDetails> findMoneyDetails(Page<UserMoneyDetails> page, @Param("userId") Long userId, @Param("classify") Integer classify);

    IPage<ErrandEvaluate> findEvaluate(Page<ErrandEvaluate> pages, @Param("riderUserId") Long userId, @Param("satisfactionFlag") String satisfactionFlag);

    int addRedPacket(@Param("userId") Long userId, @Param("redPacketType")String redPacketType, @Param("minimumAmount")BigDecimal minimumAmount,@Param("redPacketAmount") BigDecimal redPacketAmount,@Param("redPacketTitle") String redPacketTitle,@Param("expirationTime") String expirationTime, @Param("createTime")String createTime);

    int updateOldUser(@Param("userId") Long userId);

    int updateCoordinate(@Param("userId") Long userId,@Param("lng") double lng,@Param("lat") double lat);

    int updateOnLine(@Param("userId") Long userId,@Param("onLineFlag") Integer onLineFlag);

    IPage<TbIndent> rankingList(Page<TbIndent> pages, String address, String date, String dateType);

    IPage<UserMoneyDetails> selectCashDeposit(Page<UserMoneyDetails> pages, Long userId, Integer classify);

    TrainingCenter TrainingCenter(Long id);

    void updateNewUserFlagWm(Long userId);

}
